﻿using CRMWeb.Utilities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CRMWeb.Utilities.Context;

namespace CRMWeb.MasterPages
{
    public partial class User : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            hdnValUser.Value = CMSContext.CurrentUser.MemberName;
            hdnNodeVal.Value=CMSContext.CurrentUser.NodeID.ToString();
            if (!IsPostBack)
            {
                aLogin.Visible = false;
                aLogout.Visible = false;
                aWelcome.Visible = false;

                if (CMSContext.IsAuthenticated())
                {
                    aLogout.Visible = true;
                    aWelcome.Visible = true;
                    aWelcome.InnerText = "Welcome, " + CMSContext.CurrentUser.MemberName;
                }
                else
                {
                    aLogin.Visible = true;
                }
            }
        }
    }
}